printing: Use original names for remote CUPS printers
authorMarek Kasik <mkasik@redhat.com>
Thu, 20 Aug 2020 11:40:04 +0000 (13:40 +0200)
committerMarek Kasik <mkasik@redhat.com>
Thu, 20 Aug 2020 11:54:02 +0000 (13:54 +0200)
CUPS uses resource paths in the form of "printers/printer_name"
or "classes/class_name" so it is enough to remove the "printers/"
or "classes/" prefix and use the string behind it as a name.

There was recently introduced a wrong check for the prefix.
This commit fixes it in the way it was originally intended.

modules/printbackends/gtkprintbackendcups.c

index b168d3436894944db04ec7c8deb3610ad90a4756..c3ba93e639c0811a825ac608a655323de20ba83c 100644 (file)
@@ -3171,8 +3171,8 @@ avahi_service_resolver_cb (GObject      *source_object,
       if (data->resource_path != NULL)
         {
           if (data->got_printer_type &&
-              (g_strcmp0 (data->resource_path, "printers/") == 0 ||
-               g_strcmp0 (data->resource_path, "classes/") == 0))
+              (g_str_has_prefix (data->resource_path, "printers/") ||
+               g_str_has_prefix (data->resource_path, "classes/")))
             {
               /* This is a CUPS printer advertised via Avahi */
               printer_name = g_strrstr (data->resource_path, "/");